"""
@File    : car.py
@Author  : WorldWind(1772830365@qq.com)
@Time    : 2025/7/14
@Address : ChangSha - BoWeiFeng
@Date    : 2025/7/14 上午10:02
"""


class Car:
    def __init__(self, fuel):
        print('This is __init__ method. Car class startup')
        self.fuel = fuel  # 初始燃油

    def drive(self, distance):
        self.fuel -= distance * 2  # 每走一公里,消耗2L燃油
        return distance * 2

    def checkFuel(self):
        print(f"剩余油量:{self.fuel}")

    def __del__(self):
        print('This is __del__ method. The Car class has been recycled')


c1 = Car(100)
print(f'初始油量:{c1.fuel}')
f1 = c1.drive(10)
print(f'使用燃油:{f1}')
c1.checkFuel()
